﻿#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QThread>
#include <QVector>

class MyGenerate : public QThread
{
    Q_OBJECT

public:
    MyGenerate(QObject *parent);
    ~MyGenerate();
public slots:
    void RecvNum(int num);

protected:
    void run() override;
signals:
    void sendArray(QVector<int> num);

private:
    int m_num = 10000;
};

class MyQuickSort : public QThread
{
    Q_OBJECT

public:
    MyQuickSort(QObject* parent);
    ~MyQuickSort();

public slots:
    void RecvArray(QVector<int> list);

protected:
    void run() override;

signals:
    void finish(QVector<int> num);

private:
    QVector<int> m_list;

private slots:
    void quickSort(QVector<int>& list, int l, int r);
};

class MyBubbleSort : public QThread
{
    Q_OBJECT

public:
    MyBubbleSort(QObject* parent);
    ~MyBubbleSort();
public slots:
    void RecvArray(QVector<int> list);

protected:
    void run() override;

signals:
    void finish(QVector<int> num);

private:
    QVector<int> m_list;

private slots:
    void bubbleSort(QVector<int>& list, int l, int r);
};

#endif // MYTHREAD_H
